import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'LoginView',
      component: () => import('../views/LoginandTree/LoginView.vue'),
    },
    {
      path: '/MenuList',
      name: 'MenuList',
      component: () => import('../views/LoginandTree/MunuList.vue'),
      children: [
        {
           path: '/UserCreateView',
           name: 'UserCreateView',
           component: () => import('../views/User/UserCreateView.vue'),
        },
        {
           path: '/UserList',
           name: 'UserList',
           component: () => import('../views/User/UserList.vue'),
        },
        {
           path: '/UpdateUserView',
           name: 'UpdateUserView',
           component: () => import('../views/User/UpdateUserView.vue'),
        },
        {
           path: '/AddRole',
           name: 'AddRole',
           component: () => import('../views/Role/AddRole.vue'),
        },
        {
           path: '/RoleList',
           name: 'RoleList',
           component: () => import('../views/Role/RoleList.vue'),
        },
        {
           path: '/AddMenuView',
           name: 'AddMenuView',
           component: () => import('../views/Menu/AddMenuView.vue'),
        },
        {
           path: '/ListMenu',
           name: 'ListMenu',
           component: () => import('../views/Menu/ListMenu.vue'),
        },
        {
           path: '/AssMenuByRole',
           name: 'AssMenuByRole',
           component: () => import('../views/Menu/AssMenuByRole.vue'),
        },
        {  //基础设置-团队管理列表
           path: '/GetTeamInfo',
           name: 'GetTeamInfo',
           component:()=>import('../views/BaseSettings/GetTeamInfo.vue')
        },
        {  //基础设置-设备管理列表
         path: '/GetDeviceInfo',
         name: 'GetDeviceInfo',
         component:()=>import('../views/BaseSettings/GetDeviceInfo.vue')
      },
        {  //基础设置-慢病指标列表
           path: '/GetDiseaseIndicators',
           name: 'GetDiseaseIndicators',
           component:()=>import('../views/BaseSettings/GetDiseaseIndicators.vue')
         },
        {  //基础设置-种病管理列表
           path: '/GetDiseaseManagement',
           name: 'GetDiseaseManagement',
           component:()=>import('../views/BaseSettings/GetDiseaseManagement.vue')
        },
          {//基础设置-指标定义
          path: '/GetIndexDefine',
          name: 'GetIndexDefine',
          component:()=>import('../views/BaseSettings/IndexDefine.vue')
         },
          {//档案管理-档案详情
          path: '/ResidentFileDetail',
          name: 'ResidentFileDetail',
          component:()=>import('../views/ResidentFiles/ResidentFileDetail.vue')
         },
          {//档案管理-档案列表
          path: '/GetResidentFile',
          name: 'GetResidentFile',
          component:()=>import('../views/ResidentFiles/GetResidentFile.vue')
         },
          {//签约管理-集中签约
            path: '/GetCenterSign',
            name: 'GetCenterSign',
            component:()=>import('../views/Sign/CenterSign.vue')
           },
            {//签约管理-我的签约
               path: '/GetMySign',
               name: 'GetMySign',
               component:()=>import('../views/Sign/MySign.vue')
              },
           {//基础设置-采集管理
          path: '/AddCollectionManagement',
          name: 'AddCollectionManagement',
          component:()=>import('../views/Cmanage/AddCollectionManagement.vue')
        },
         {//知识管理-我的知识列表
            path: '/GetKnowledge',
            name: 'GetKnowledge',
            component:()=>import('../views/KnowledgeManagement/GetKnowledge.vue')
          }
          , {//知识管理-知识查阅列表
            path: '/QueryKnowledge',
            name: 'QueryKnowledge',
            component:()=>import('../views/KnowledgeManagement/QueryKnowledge.vue')
          }
          ,
          {//角色管理-管理概况
            path: '/ManagOver',
            name: 'ManagOver',
            component:()=>import('../views/Decision/ManagOver.vue')
          },
          {//角色管理-管理层级
            path: '/Managhier',
            name: 'Managhier',
            component:()=>import('../views/Decision/Managhier.vue')
          },
          {//角色管理-工作量统计
            path: '/Worklatistic',
            name: 'Worklatistic',
            component:()=>import('../views/Decision/Worklatistic.vue')
          },
          {//智慧健康-轮播图管理-新增
            path: '/CarouselimageCreate',
            name: 'CarouselimageCreate',
            component:()=>import('../views/SmartHealthcareZSJ/CarouselimageCreate.vue')
          },
          {//智慧健康-轮播图管理-查询
            path: '/CarouselimageQuery',
            name: 'CarouselimageQuery',
            component:()=>import('../views/SmartHealthcareZSJ/CarouselimageQuery.vue')
          },
          {//智慧健康-轮播图管理-修改
            path: '/CarouselimageUpdate',
            name: 'CarouselimageUpdate',
            component:()=>import('../views/SmartHealthcareZSJ/CarouselimageUpdate.vue')
          },
          {//智慧健康-医院管理-新增
            path: '/HospitalManagementCreate',
            name: 'HospitalManagementCreate',
            component:()=>import('../views/HospitalManagement/HospitalManagementCreate.vue')
          },
          {//智慧健康-医院管理-查询
            path: '/HospitalManagementList',
            name: 'HospitalManagementList',
            component:()=>import('../views/HospitalManagement/HospitalManagementList.vue')
          },
          // {//智慧健康-医院管理-修改
          //   path: '/HospitalManagementUpdate',
          //   name: 'HospitalManagementUpdate',
          //   component:()=>import('../views/HospitalManagement/HospitalManagementUpdate.vue')
          // },
          {//智慧健康-医院管理-修改
            path: '/HospitalManagementInfo',
            name: 'HospitalManagementInfo',
            component:()=>import('../views/HospitalManagement/HospitalManagementInfo.vue')
          },
           {//智慧健康-医院管理-修改
            path: '/DepartmentManagementList',
            name: 'DepartmentManagementList',
            component:()=>import('../views/DepartmentManagement/DepartmentManagementList.vue')
          },
          {//基础设置-转诊管理
             path: '/GetInstitutionView',
             name: 'GetInstitutionView',
             component:()=>import('../views/BaseSettings/GetInstitutionView.vue')
         },
           {//基础设置-健康报告
              path: '/GetReports',
              name: 'GetReports',
              component:()=>import('../views/BaseSettings/GetReportsView.vue')
            },
            {//基础设置-随访管理
               path: '/GetFollow',
               name: 'GetFollow',
               component:()=>import('../views/BaseSettings/GetFollow.vue')
             },
         
         // {//工作台
         //    path: '/WorkTower',
         //    name: 'WorkTower',
         //    component:()=>import('../views/Workbenches/WorkTower.vue')
         // },
         {//工作台-试验品
            path: '/WorkTower2',
            name: 'WorkTower2',
            component:()=>import('../views/Workbenches/WorkTower2.vue')
         },
         {//百度地图
            path: '/BaiduMap',
            name: 'BaiduMap',
            component:()=>import('../views/User/BaiduMap.vue')
          },
           {//慢病管理-慢病列表
            path: '/CDMList',
            name: 'CDMList',
            component:()=>import('../views/ChronicDiseaseManagement/CDMList.vue')
          },
           {//慢病管理-慢病列表-总览
            path: '/PatientDetail',
            name: 'PatientDetail',
            component:()=>import('../views/ChronicDiseaseManagement/PatientDetail.vue')
          },
           {
            path: '/qq',
            name: 'qq',
            component:()=>import('../views/KnowledgeManagement/qq.vue')
          },
          
      ]
  },
    
    
  ],
})


router.beforeEach((to, from, next) => {

   //console.log('to:' + to.name + ',from:' + from.name + ',next:' + next);
   if (!localStorage.getItem("token") && to.name !== 'LoginView') {
       next({ name: 'LoginView' })
   }
   else {
               next()
   }
})
export default router
